home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 17 / CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso / CUCD / Programming / DiceSource / src / dlink / hash.a < prev    next >
Encoding:
Text File  |  1992-10-25  |  590 b   |  39 lines

  1.  
  2.             ;   hash.a handles the hash() function which takes
  3.             ;   a huge chunk of cpu, thus it is optimized here.
  4.             ;
  5.             ;   hash(str,len) return value & 1023
  6.             ;
  7.             ;   NOTE, this is a different function than that
  8.             ;   in SYM.C
  9.  
  10.             section text,code
  11.  
  12.             xdef    _hash
  13.             xdef    @hash
  14.  
  15. _hash
  16.             move.l    4(sp),A0
  17.             move.l    8(sp),D0
  18. @hash
  19.             move.l    D2,-(sp)
  20.             move.l    #$1234FCB4,D1
  21.             beq    hend
  22. hloop            asl.l    #5,D1
  23.             move.b    (A0)+,D2
  24.             eor.b    D2,D1
  25.             move.l    D1,D2
  26.             lsr.l    #7,D2
  27.             eor.l    D2,D1
  28.             subq.w    #1,D0
  29.             bne    hloop
  30.  
  31. hend            and.l    #1023,D1
  32.             move.l    (sp)+,D2
  33.             move.l    D1,D0
  34.             rts
  35.  
  36.             END
  37.  
  38.  
  39.